package flirtme.model;

import java.util.Date;

public abstract class BaseMessage 
{
	static protected final int MSG_PREVIEW_LENGHT = 15;
	
	protected Long id;
	protected String content;
	protected Date timestamp;
	

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	public String getMessagePreview() {
		if (this.content != null) {
			if (this.content.length() > MSG_PREVIEW_LENGHT) {
				return this.content.substring(0, MSG_PREVIEW_LENGHT) + "...";
			} else {
				return this.content;
			}
		}
		return "";
	}

}
